import artRender from '@/utils/artRenter';
import Router from '@koa/router';
import { Context } from 'koa';
import MenuService from '@/services/menu.service'
import ArticleService from '@/services/article.service'

const router = new Router({ prefix: '/views' });

router.get('/news', async (ctx: Context) => {
  const [menuData,news]= await Promise.all([
    MenuService.getTree(),
    ArticleService.selectList({
          page:1,
          pageSize: 10,      
          orderBy:'id desc',      
          searchText: "",
          
      
    })
  ])

  await artRender(ctx, 'news.art', {
    title:"达美",
    siteName:"新闻",
    menuData,
    news:news.list



  })




});


export default router;